﻿<%@ Page Language="C#" MasterPageFile="../main.master" Inherits="VioletDevelopmentLaboratory.Net.Web.Configuration.VWebConfigManagerPage" %>

<script runat="server">
	protected void RoleManagerDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}

	protected void ProvidersGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
	{
		ProvidersDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
	}

	protected void ProvidersDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
	{
		ShowAlert_DetailsView_ItemInserted(e);

		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}

	protected void ProvidersDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);

		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}

	protected void ProvidersDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
	{
		ShowAlert_DetailsView_ItemDeleted(e);

		ProvidersDetailsView.ChangeMode(DetailsViewMode.Insert);
		
		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">

	<h2>RoleManager (SqlRoleProvider)</h2>

	<div>
		<asp:ObjectDataSource ID="RoleManagerDetailsViewDataSource" runat="server" 
			SelectMethod="GetRoleManager" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.RoleManagerSectionManager" 
			UpdateMethod="Modify">
			<UpdateParameters>
				<asp:Parameter Name="cacheRolesInCookie" Type="Boolean" />
				<asp:Parameter Name="cookieName" Type="String" />
				<asp:Parameter Name="cookiePath" Type="String" />
				<asp:Parameter Name="cookieProtection" Type="Object" />
				<asp:Parameter Name="cookieRequireSSL" Type="Boolean" />
				<asp:Parameter Name="cookieSlidingExpiration" Type="Boolean" />
				<asp:Parameter Name="cookieTimeout" Type="Object" />
				<asp:Parameter Name="createPersistentCookie" Type="Boolean" />
				<asp:Parameter Name="defaultProvider" Type="String" />
				<asp:Parameter Name="domain" Type="String" />
				<asp:Parameter Name="enabled" Type="Boolean" />
				<asp:Parameter Name="maxCachedResults" Type="Int32" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<legend>roleManager</legend>
			<asp:DetailsView ID="RoleManagerDetailsView" runat="server" CellPadding="5" 
				DefaultMode="Edit" AutoGenerateRows="False" 
				DataSourceID="RoleManagerDetailsViewDataSource" 
				onitemupdated="RoleManagerDetailsView_ItemUpdated">
				<Fields>
					<asp:CheckBoxField DataField="CacheRolesInCookie" 
						HeaderText="CacheRolesInCookie" SortExpression="CacheRolesInCookie" />
					<asp:BoundField DataField="CookieName" HeaderText="CookieName" 
						SortExpression="CookieName" />
					<asp:BoundField DataField="CookiePath" HeaderText="CookiePath" 
						SortExpression="CookiePath" />
					<asp:TemplateField HeaderText="CookieProtection" 
						SortExpression="CookieProtection">
						<EditItemTemplate>
							<asp:DropDownList ID="CookieProtectionDropDownList" runat="server"
								SelectedValue='<%# Bind("CookieProtection") %>'>
								<asp:ListItem>None</asp:ListItem>
								<asp:ListItem>Validation</asp:ListItem>
								<asp:ListItem>Encryption</asp:ListItem>
								<asp:ListItem>All</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:CheckBoxField DataField="CookieRequireSSL" HeaderText="CookieRequireSSL" 
						SortExpression="CookieRequireSSL" />
					<asp:CheckBoxField DataField="CookieSlidingExpiration" 
						HeaderText="CookieSlidingExpiration" SortExpression="CookieSlidingExpiration" />
					<asp:BoundField DataField="CookieTimeout" HeaderText="CookieTimeout" 
						SortExpression="CookieTimeout" />
					<asp:CheckBoxField DataField="CreatePersistentCookie" 
						HeaderText="CreatePersistentCookie" SortExpression="CreatePersistentCookie" />
					<asp:BoundField DataField="DefaultProvider" HeaderText="DefaultProvider" 
						SortExpression="DefaultProvider" />
					<asp:BoundField DataField="Domain" HeaderText="Domain" 
						SortExpression="Domain" />
					<asp:CheckBoxField DataField="Enabled" HeaderText="Enabled" 
						SortExpression="Enabled" />
					<asp:BoundField DataField="MaxCachedResults" HeaderText="MaxCachedResults" 
						SortExpression="MaxCachedResults" />
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 30px">
		<asp:ObjectDataSource ID="ProvidersDetailsViewDataSource" runat="server" 
			DeleteMethod="RemoveProvider" InsertMethod="AddProvider" 
			SelectMethod="GetProvider" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.RoleManagerSectionManagerForSql" 
			UpdateMethod="ModifyProvider" 
			
			
			
			DataObjectTypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.SqlRoleProviderSettings">
			<SelectParameters>
				<asp:ControlParameter ControlID="ProvidersGridView" Name="name" 
					PropertyName="SelectedValue" Type="String" />
			</SelectParameters>
		</asp:ObjectDataSource>
		<asp:ObjectDataSource ID="ProvidersGridViewDataSource" runat="server" 
			SelectMethod="GetProviders" 
			
			
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.RoleManagerSectionManagerForSql"></asp:ObjectDataSource>
		<fieldset>
			<legend>provider</legend>
			<asp:DetailsView ID="ProvidersDetailsView" runat="server" 
				AutoGenerateRows="False" CellPadding="5" 
				DataSourceID="ProvidersDetailsViewDataSource" DefaultMode="Insert" 
				oniteminserted="ProvidersDetailsView_ItemInserted" 
				onitemupdated="ProvidersDetailsView_ItemUpdated" 
				onitemdeleted="ProvidersDetailsView_ItemDeleted" DataKeyNames="Name">
				<Fields>
					<asp:BoundField DataField="Name" HeaderText="Name" 
						SortExpression="Name" />
					<asp:BoundField DataField="Type" 
						HeaderText="Type" SortExpression="Type" />
					<asp:BoundField DataField="ConnectionStringName" 
						HeaderText="ConnectionStringName" SortExpression="ConnectionStringName" />
					<asp:BoundField DataField="CommandTimeout" HeaderText="CommandTimeout" 
						SortExpression="CommandTimeout" />
					<asp:BoundField DataField="Description" HeaderText="Description" 
						SortExpression="Description" />
					<asp:BoundField DataField="ApplicationName" HeaderText="ApplicationName" 
						SortExpression="ApplicationName" />
					<asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
						ShowEditButton="True" ShowInsertButton="True" />
				</Fields>
			</asp:DetailsView>
			<asp:GridView ID="ProvidersGridView" runat="server" AutoGenerateColumns="False" 
				CellPadding="5" DataKeyNames="Name" DataSourceID="ProvidersGridViewDataSource" 
				onselectedindexchanging="ProvidersGridView_SelectedIndexChanging">
				<Columns>
					<asp:CommandField ShowSelectButton="True" />
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
					<asp:BoundField DataField="ConnectionStringName" 
						HeaderText="ConnectionStringName" SortExpression="ConnectionStringName" />
					<asp:BoundField DataField="CommandTimeout" HeaderText="CommandTimeout" 
						SortExpression="CommandTimeout" />
					<asp:BoundField DataField="Description" HeaderText="Description" 
						SortExpression="Description" />
					<asp:BoundField DataField="ApplicationName" HeaderText="ApplicationName" 
						SortExpression="ApplicationName" />
				</Columns>
				<SelectedRowStyle BackColor="SkyBlue" />
			</asp:GridView>
		</fieldset>
	</div>
</asp:Content>